<template>
    <div class="container">
		<h3>审核还款</h3>
        <el-form :model="ruleForm" ref="ruleForm" :rules="rules"  label-width="180px" class="demo-ruleForm">
           <el-table
               :data="tableData"
               border
               style="margin-top:20px;"
               ref="multipleTable"
               header-cell-class-name="table-header"
           >
			<el-table-column prop="name" sortable label="申请人"></el-table-column>
			   <el-table-column prop="createTime" sortable label="申请时间"></el-table-column>
			   <el-table-column prop="amount" sortable label="申请金额"></el-table-column>
			   <el-table-column prop="bankName" sortable label="申请银行" width="200"></el-table-column>
			   <el-table-column sortable label="审核状态">
				   <template slot-scope="scope">
					   <div v-show="scope.row.status== 0">审核中</div>
					   <div v-show="scope.row.status== 1">已通过</div>
					   <div v-show="scope.row.status== -1">已拒绝</div>
				   </template>
			   </el-table-column>

			   <el-table-column label="操作" width="150" align="center">
				   <template slot-scope="scope">
					 <el-button
						 type="text"
						 v-if="scope.row.status == 0"
						 @click="repayment(scope.$index, scope.row)"
					 >审核</el-button>
					   <el-button
						   type="text"

						   @click="handleCheck(scope.$index, scope.row)"
					   >查看</el-button>
				   </template>
			   </el-table-column>
           </el-table>
           <el-pagination
               layout="total, prev, pager, next, jumper"
               :page-size="pagesize1"
               :current-page.sync="page"
               :total="total1"
               @current-change="handleCurrentChange1"
               style="margin-top: 20px"
           ></el-pagination>
            <el-form-item class="footerFixed" label-width="0px">
                <el-button @click="backPage">返回</el-button>
            </el-form-item>

        </el-form>
    </div>
</template>

<script>
import axios from "axios"
import uploadImg from '../../../common/uploadImg';
export default {
	components: {
	    uploadImg
	},
    data() {
        return {
			ruleForm:{},
			pagesize1:10,
			page:1,
			total1:0,

			tableData:[],
			amount:{},
			backname:{},
			bankShow:false,
			bankList:[],
			subBank:[],
            rules: {},
			id:''
        };
    },
    mounted() {

        this.init();

    },
    methods: {
		handleCurrentChange1(val){

			this.page = val;
			this.init();
		},

		// 返回上一页
        backPage() {
            this.$router.go(-1);
        },
		// 获取详情
        init(){
			let data = {
				page:this.page
			}
			axios.post("https://bbgy.cpzsyun.com:82/api/control/loanInfo/findByList",data).then((res)=>{
				this.tableData = res.data.rows
				this.total = res.data.total
				for(let i = 0 ; i<this.tableData.length;i++){
					this.tableData[i].createTime = this.tableData[i].createTime.substring(0,10)
				}
			})
		},

		//还款
		repayment(index,row){
			this.$router.push({
			    path: '/finance/add',
			    query: {
			        id: row.id
			    }
			});
		},
		handleCheck(index,row){
			this.$router.push({
			    path: '/finance/check1',
			    query: {
			        id: row.id
			    }
			});
		},
    }
};
</script>

<style scoped>
	.el-pagination {
	    text-align: center;
	}
</style>
